#pragma once

#include "graphics/GrVector.h"

class CBezierCurve
{
protected:
	CGrVector _controlPts[4]; //these are 4 coordinate triples (points)
	CGrVector _coefficients[3]; //each of these correspond to a variable, i.e. [0] is X's equation

	bool _calculated; //if a control point changes we need to recalculate

	CGrVector assemblePolynomial(double t);

public:
	CBezierCurve(void);
	CBezierCurve(const CBezierCurve&);
	virtual ~CBezierCurve(void);
	
	virtual void setControlPoint(int n, CGrVector cp);
	virtual void calculateCoefficients();
	virtual double X(double t);
	virtual double Y(double t);
	virtual double Z(double t);
	virtual CGrVector FindPoint(double t);

	void debug_DrawCurve();
};
